<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title></title>
		<script type="text/javascript">
			var random = Math.round(Math.random() * 1000 + 1);
			console.log(random);
			function guess(){
				var num = 0;
				while(true){
					num= document.getElementById("input").value;
					if(parseInt(num)>random){
						result.innerHTML = "太大了！";
						break;
					}else if(parseInt(num)<random){
						result.innerHTML = "太小了！";
						break;
					}else{
						result.innerHTML = "猜对了!";
						break;
					}
				}
			}
		</script>
	</head>
	<body>
		<input id="input" type="text" />
		<input type="button" onclick="guess()" value="猜"/>
		<span id="result"></span>
	</body>
</html>
